<template>
    <layout :config="navConfig">
        <template #default>
            <div class="m-review-tab">
                <label style="width: 100%">
                    <input type="radio" style="width: 100%" v-model="activeTab" :value="1">
                    <span style="width: 100%">银行转账</span>
                </label>
                <!--<label>-->
                <!--<input type="radio" v-model="activeTab" :value="2">-->
                <!--<span>支付宝转账</span>-->
                <!--</label>-->
                <!--<label>-->
                <!--<input type="radio" v-model="activeTab" :value="3">-->
                <!--<span>银行转账</span>-->
                <!--</label>-->
            </div>

            <div class="m-review-form" v-show="activeTab===1">
                <div class="form-col">
                    <div class="col-text">开户银行</div>
                    <input type="tel" v-model="formData_1.bankname">
                </div>
                <div class="form-col">
                    <div class="col-text">开户银行账户</div>
                    <input type="tel" v-model="formData_1.banknum">
                </div>
                <div class="form-col">
                    <div class="col-text">开户银行地址</div>
                    <input type="text" v-model="formData_1.bankaddr">
                </div>
                <div class="form-col">
                    <div class="col-text">转账金额</div>
                    <input type="number" v-model="paymoney">
                </div>
                <div class="form-col">
                    <div class="col-text">转账备注</div>
                    <input type="number" v-model="formData_1.commit">
                </div>

            </div>

            <!--<div class="m-review-form" v-show="activeTab===2">-->
            <!--<div class="form-col">-->
            <!--<div class="col-text">上上级ID</div>-->
            <!--<input type="tel" v-model="formData_2.id">-->
            <!--</div>-->
            <!--<div class="form-col">-->
            <!--<div class="col-text">上上级电话</div>-->
            <!--<input type="tel" v-model="formData_2.tel">-->
            <!--</div>-->
            <!--<div class="form-col">-->
            <!--<div class="col-text">上上级微信</div>-->
            <!--<input type="text" v-model="formData_2.weChat">-->
            <!--</div>-->
            <!--<div class="form-col">-->
            <!--<div class="col-text">上上级银行卡</div>-->
            <!--<input type="number" v-model="formData_2.card">-->
            <!--</div>-->
            <!--<div class="form-col">-->
            <!--<div class="col-text">上上级支付宝收款码</div>-->
            <!--<div class="qrcode-box">-->
            <!--<qr-code :margin="10" :text="formData_2.qrCode"></qr-code>-->
            <!--</div>-->
            <!--</div>-->
            <!--</div>-->

            <button class="m-review-button" @click="confirm">确认打款</button>
        </template>
    </layout>
</template>

<script lang="ts">
    import {Component, Vue} from "vue-property-decorator";
    import {INavigation} from "@/types";
    import qrCode from "vue-qr";
    import {Toast} from "mand-mobile";
    @Component({
        name: "Review",
        components: {
            qrCode
        },
        created: function () {
            this.type = this.$route.query.key;
            this.paymoney = this.$route.query.money/100*10;

            let usera = JSON.parse(localStorage.getItem('users1'));

            if(usera==null){
                this.$router.push({
                    path: '/login'
                })
                return;
            }

            Toast.loading("请求中...");
            this.$api.querypay({}).then(res => {
                Toast.hide();
                if (res.success == 200) {
                    this.formData_1 = res.data;
                    this.formData_1.commit=usera.username;
                    console.log(res.data);
                }
            }).catch(res => {

            })


        },
    })
    export default class extends Vue {
        navConfig: INavigation = {
            text: "马上购买"
        };
        type= 1;
        paymoney= 0;
        activeTab = 1;
        formData_1 = {
            bankname: "",
            banknum: "",
            bankaddr: "",
            commit: "",
        };
        formData_2 = {
            id: "",
            tel: "",
            weChat: "",
            card: "",
            qrCode: "tesla.facebook"
        };

        confirm() {
            this.$router.push({
                path: '/comfirmPay',
                query: {
                    type: this.type,
                    money: this.paymoney,
                    flag:1
                }
            })
        }
    }
</script>

<style lang="scss">
    @import "../assets/styles/review.scss";
</style>

